package com.hemerasolutions.v2trainer.converter;

import java.io.Serializable;

import javax.faces.convert.FacesConverter;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.NumberConverter;


@FacesConverter("dynamicDateConverter")
public class DynamicDateConverter extends NumberConverter implements Serializable{

	private static final long serialVersionUID = 1L;

    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {

    	setPattern((String) component.getAttributes().get("pattern"));
        return super.getAsObject(context, component, value);
    }

    @Override
    public String getAsString(FacesContext context, UIComponent component, Object value) {

    	setPattern((String) component.getAttributes().get("pattern"));
        return super.getAsString(context, component, value);
    }
}

